Readonly or mutable engine as per user configuration#65
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #49
Add an AccessMode { Mutable, ReadOnly } setting to ParseConfiguration
(default Mutable, no behavior change for existing callers) and a frozen
read-only engine boundary.
- ReadOnlyNetwork: a compile-time read-only view that derefs to
&LinkNetwork, exposing every non-mutating operation while leaving the
&mut self mutators unreachable (no DerefMut). Held behind an Arc so
clones share one allocation.
- LinkNetwork::freeze / as_read_only produce the view; EngineNetwork and
LinkNetwork::parse_engine honour the configured access mode and reject
mutation at runtime with a ReadOnlyViolation diagnostic.
- Snapshot interop: NetworkSnapshot::as_read_only / from_read_only reuse
the snapshot's Arc<LinkNetwork>, composing with snapshot versioning
instead of duplicating it.
- Tests cover freeze -> query/reconstruct/verify, compile-fail mutation
(doctest), runtime ReadOnlyViolation, snapshot interop, and Arc sharing.
- Changelog fragment (bump: minor); README usage example.
Working session summaryWorking tree is clean. The implementation is complete. Here's a summary of what was done for issue #49. SummaryImplemented R-1 / S-1 from the issue #47 case study: a read-only or mutable engine selected by user configuration. PR #65 is updated and marked ready; all CI checks pass. Changes
Tests ( Docs — README feature bullet + usage example; changelog fragment ( Acceptance criteria — all met
Note on a CI fix mid-wayThe first push failed the file-size guard because This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $4.035761📊 Context and tokens usage:
Total: (8.5K new + 92.2K cache writes + 5.3M cache reads) input tokens, 30.5K output tokens, $4.035761 cost 🤖 Models used:
📎 Log file uploaded as Gist (1911KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 1)Reason: Merge conflicts detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
…e-49-3a3011bb1089 # Conflicts: # .gitkeep
Working session summaryThe merge conflicts are resolved and everything is verified clean. SummaryThe PR #65 had merge conflicts against its base branch Conflicts resolved (2):
The base branch also brought in the data-exchange format grammars work (JSON/YAML/TOML/XML/INI/protobuf/GraphQL), which merged without issue. Verification:
Final PR status: Merge commit This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $0.552220📊 Context and tokens usage:
Total: (2.7K new + 20.4K cache writes + 583.3K cache reads) input tokens, 4.8K output tokens, $0.552220 cost 🤖 Models used:
📎 Log file uploaded as Gist (2442KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🎉 Auto-mergedThis pull request has been automatically merged by hive-mind.
Auto-merged by hive-mind with --auto-merge flag |
Summary
Implements R-1 / S-1 from the issue #47 case study: a read-only or mutable
engine selected by user configuration. Today
LinkNetworkis always mutable;this adds an enforced read-only mode that composes with existing snapshot
sharing instead of duplicating it.
Fixes #49.
What changed
AccessMode { Mutable, ReadOnly }onParseConfiguration(
with_access_mode/access_mode). Defaults toMutable, so existingcallers see no behavior change.
ReadOnlyNetwork— a frozen view produced byLinkNetwork::freeze()/as_read_only(). It derefs to&LinkNetwork, exposing every non-mutatingoperation (query, project, reconstruct, verify, serialize) while leaving the
&mut selfmutators unreachable at compile time (there is noDerefMut).The network is held behind an
Arc, so clones share one allocation.EngineNetwork+LinkNetwork::parse_engine()— the runtimeboundary that honours the configured access mode. Read-only parsing returns
the frozen form, and
EngineNetwork::as_mutable()rejects mutation with aclear
ReadOnlyViolationdiagnostic.NetworkSnapshot::as_read_only()/from_read_only()reuse the snapshot'sArc<LinkNetwork>, so freezing andsnapshot versioning share one allocation.
Acceptance criteria
ParseConfigurationcarries an access mode; default remainsMutable.the mutating ones (compile-time enforced via
Deref-without-DerefMut).impossible (
compile_faildoctest) and rejected at the engine boundary(
ReadOnlyViolation); snapshot interop;Arcsharing.bump: minor).How to verify
Read-only usage: